package com.transaction.demo.trade.controller;

import com.transaction.demo.trade.vo.req.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.transaction.demo.common.util.Result;
import com.transaction.demo.common.util.ResultPage;
import com.transaction.demo.trade.vo.resp.TradePaymentOrderRespVo;
import com.transaction.demo.trade.service.TradePaymentOrderService;

/**
 * 描述：支付订单表
 * 作者：马庆智
 * 日期：2023/04/27 17:22:10
 */
@Api(tags = "支付订单表")
@RestController
@RequestMapping("/tradePaymentOrder")
public class TradePaymentOrderController {

   @Autowired
   private TradePaymentOrderService tradePaymentOrderService;

   /**
    * 初始化订单
    *
    * @param record 请求参数
    * @return TradePaymentOrderResp
    * @author 马庆智
    * @date: 2023/04/27 17:22:10
    */
   @ApiOperation("初始化订单")
   @PostMapping("/initPaymentOrder")
   public Result<String> initPaymentOrder(@RequestBody @Valid InitPaymentOrderReqVo record){
      return tradePaymentOrderService.initPaymentOrder(record);
   }

   /**
    * 完成支付
    *
    * @param record 请求参数
    * @return TradePaymentOrderResp
    * @author 马庆智
    * @date: 2023/04/27 17:22:10
    */
   @ApiOperation("初始化订单")
   @PostMapping("/completePay")
   public Result<String> completePay(@RequestBody @Valid CompletePayReqVo record){
      return tradePaymentOrderService.completePay(record);
   }

   /**
    * 查询支付订单表
    *
    * @param record 请求参数
    * @return TradePaymentOrderResp
    * @author 马庆智
    * @date: 2023/04/27 17:22:10
    */
   @ApiOperation("查询支付订单表")
   @PostMapping("/queryTradePaymentOrder")
   public TradePaymentOrderRespVo query(@RequestBody @Valid TradePaymentOrderReqVo record){
       return tradePaymentOrderService.queryTradePaymentOrder(record);
   }

   /**
    * 查询支付订单表列表
    *
    * @param record 请求参数
    * @return TradePaymentOrderResp
    * @author 马庆智
    * @date: 2023/04/27 17:22:10
    */
   @ApiOperation("查询支付订单表列表")
   @PostMapping("/queryTradePaymentOrderList")
   public Result<ResultPage<TradePaymentOrderRespVo>> queryTradePaymentOrderList(@RequestBody @Valid TradePaymentOrderListReqVo record){
        return Result.success(tradePaymentOrderService.queryTradePaymentOrderList(record));
   }



   /**
    * 删除支付订单表
    *
    * @param ids 请求参数
    * @return Result<Integer>
    * @author 马庆智
    * @date: 2023/04/27 17:22:10
    */
   @ApiOperation("删除支付订单表")
   @PostMapping("/deleteTradePaymentOrder")
   public Result<Integer> deleteTradePaymentOrder(String ids){
        return Result.success(tradePaymentOrderService.deleteTradePaymentOrder(ids));
   }

   /**
    * 更新支付订单表
    *
    * @param record 请求参数
    * @return Result<Integer>
    * @author 马庆智
    * @date: 2023/04/27 17:22:10
    */
   @ApiOperation("更新支付订单表")
   @PostMapping("/updateTradePaymentOrder")
   public Result<Integer> updateTradePaymentOrder(@RequestBody @Valid TradePaymentOrderUpdateReqVo record){
        return Result.success(tradePaymentOrderService.updateTradePaymentOrder(record));
   }

}